import 'package:flutter_test/flutter_test.dart';
import 'package:share_preference_huawei/share_preference_huawei.dart';
import 'package:share_preference_huawei/share_preference_huawei_platform_interface.dart';
import 'package:share_preference_huawei/share_preference_huawei_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockSharePreferenceHuaweiPlatform
    with MockPlatformInterfaceMixin
    implements SharePreferenceHuaweiPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');
}

void main() {
  final SharePreferenceHuaweiPlatform initialPlatform = SharePreferenceHuaweiPlatform.instance;

  test('$MethodChannelSharePreferenceHuawei is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelSharePreferenceHuawei>());
  });

  test('getPlatformVersion', () async {
    SharePreferenceHuawei sharePreferenceHuaweiPlugin = SharePreferenceHuawei();
    MockSharePreferenceHuaweiPlatform fakePlatform = MockSharePreferenceHuaweiPlatform();
    SharePreferenceHuaweiPlatform.instance = fakePlatform;

    expect(await sharePreferenceHuaweiPlugin.getPlatformVersion(), '42');
  });
}
